Reading a polarization map at 100 GHz


In [1]:
path = "/Users/inchani/Desktop/UC\ Davis/My\ Courses/STA\ 250\ (AstroStatistics)/Project/"; 
include("$path""lib.jl")
map_name = "HFI_SkyMap_100_2048_R2.02_full.fits"; # Polarization map at 100 GHz
using PyCall, PyPlot, StatsBase
@pyimport healpy as hp
@pyimport healpy.fitsfunc as fitsfunc;
@pyimport healpy.pixelfunc as pixelfunc;
@pyimport numpy as np;

 =      = 0.0007669903939429012;  # 5 arcmin of resolution to radian
res_highest = 3. / 60. * pi / 180;    # 3 arcmin  (actual highest resolution = 2.637 arcmin at equator)

NSIDE = 2048;
Nested = false;
I_STOKES = hp.read_map("$path$map_name", field = 0, memmap = true);
dim = length(I_STOKES);

const dtheta_deg = 15.
const dtheta = dtheta_deg / 180 * pi;   # 15 degrees in radian
const FWHM    = 30. / 60. * pi / 180;   # 30. arcmin to radian unit (See Planck 2013 ISW paper)
const σ       = FWHM / 2.355            # 2.355 ~ 2√(2log(2))
const σnorm2  = 2.*σ^2.
const σlim2   = (3σ)^2.  

const angsize    = copy(dtheta_deg*2)             # width and height in degree 
const XYsize     = angsize * pi / 180;            # in radian 
#const res        = 6. / 60. * pi / 180;  
const res        = 3. / 60. * pi / 180;  
        # 6 arcmin of pixel size in radian unit (See Planck 2013 ISW paper)
const Nsize      = Int64(round(XYsize/res));      # 600

const Tmin = -593.5015506111085; # mu K  
const Tmax =  709.0113358572125; # mu K 
# min and max temperature if we take out 40 % of sky as foreground


NSIDE = 2048
ORDERING = NESTED in fits file
INDXSCHM = IMPLICIT
Ordering converted to RING
/Users/inchani/.local/lib/python2.7/site-packages/healpy/fitsfunc.py:335: UserWarning: No INDXSCHM keyword in header file : assume IMPLICIT
  "assume {}".format(schm))
Out[1]:
709.0113358572125

In [3]:
function PlotTempProfile(Rmax::Float64,dR::Float64,Temperature::Array{Float64, 2};vmin=1.,vmax=0.)
    x1dang = linspace(-dtheta_deg,dtheta_deg,Nsize); y1dang = linspace(-dtheta_deg,dtheta_deg,Nsize);# dR = 0.1;
    R0 = dR;# Rmax = 15.
    dim = Int((Rmax - R0) / dR) + 1
    Rarr   = linspace(R0,Rmax,dim) - dR/2
    numarr = zeros(dim)
    Tarr   = zeros(dim)
    for i=1:Nsize
        for j=1:Nsize
            n = Int(floor(  (x1dang[j]^2 +y1dang[i]^2) / dR) ) + 1
            if n <= dim
                Tarr[n] += Temperature[i,j]
                numarr[n] += 1.
            end
        end
    end
    for i=1:dim
        Tarr[i] = Tarr[i] / numarr[i]
    end
    PyPlot.plot(Rarr,Tarr)
    if vmin > vmax
        vmin = np.min(Tarr)
        vmax = np.max(Tarr)
    end
    PyPlot.xlabel("Distance from center (\$\\degree\$\)")
    PyPlot.ylabel("Average Temperature  (\$\\mu\$\K\$\_{CMB}\$\)")    
    PyPlot.xlim(0,Rmax)
    PyPlot.ylim(vmin,vmax)
end

function PlotTmap(Temperature::Array{Float64, 2},vmin::Float64,vmax::Float64,Rmax::Float64)    
    PyPlot.imshow(Temperature, origin='l',vmin = vmin, vmax = vmax, extent= [-15,15,-15,15])
    PyPlot.xlabel("degree (\$\\degree\$\)")
    PyPlot.ylabel("degree (\$\\degree\$\)")
    PyPlot.colorbar(label= " \$\\mu\$\K\$\_{CMB}\$\ ");
end


Out[3]:
PlotTmap (generic function with 1 method)

In [ ]:
Q_STOKES = hp.read_map("$path$map_name", field = 1, memmap = true);
U_STOKES = hp.read_map("$path$map_name", field = 2, memmap = true);

Each fits file contains:

Field 0 = I_STOKES, the intensity in each specific band Field 1 = Q_STOKES, the polarized brightness Field 2 = U_STOKES,
Field 3 = HITS , the number of observations Field 4 = II_COV , the variance in the corresponding Stokes parameter Field 5 = IQ_COV
Field 6 = IU_COV , the covariance inbetween the corresponding Stokes parameter
Field 7 = QQ_COV
Field 8 = QU_COV
Field 9 = UU_COV

Reading mask maps


In [2]:
GalMapFile = "HFI_Mask_GalPlane-apo5_2048_R2.00.fits"
PtMapFile  = "HFI_Mask_PointSrc_2048_R2.00.fits"
GalMap     = hp.read_map("$path$GalMapFile", field = 2, memmap = true); # 40% of sky is ruled out
PtMap      = hp.read_map("$path$PtMapFile", field = 0, memmap = true);


NSIDE = 2048
ORDERING = NESTED in fits file
INDXSCHM = IMPLICIT
Ordering converted to RING
NSIDE = 2048
ORDERING = NESTED in fits file
INDXSCHM = IMPLICIT
Ordering converted to RING

(Ordering converted to RING)

Intensity of all-sky map before masking


In [3]:
hp.mollview(I_STOKES*1e6, xsize = 800, title = "Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)
savefig("$path/allskymap.png")


/Users/inchani/python/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):

masking galactic foregrounds and point sources


In [3]:
planck_map_mask = copy(I_STOKES)*1e6
cnt = 0
for i = 1:max(length(GalMap),length(PtMap))
    if (GalMap[i] == 0.) | (PtMap[i] == 0.)
        planck_map_mask[i] = hp.UNSEEN
        cnt += 1
    end
end

Intensity of all-sky map after masking galactic foregrounds and point sources


In [4]:
hp.mollview(planck_map_mask, xsize = 800, title = "Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)
savefig("$path/allskymap_mask.png")


/Users/inchani/python/anaconda/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  if self._edgecolors == str('face'):

Loading supercluster / void sources

How to use pixelfunc for change index to coord, or vice versa. @pyimport healpy.pixelfunc as pixelfunc ind = 0 l,b = pixelfunc.pix2ang(2048,ind,nest=false) # pixel index > Spherical Coord, [θ, ϕ] [radian unit] ind_rtn = pixelfunc.ang2pix(2048,l,b,nest=false) # Spherical Coord, [θ, ϕ]> pixel index Note: ϕ = 0 (θ=90 deg) is toward galactic center > need to convert coordinates of SZ sources increasing ϕ = moving East, increasing θ = moving South


In [5]:
CoordSZ       = np.load("$path""Coord_SZ.npy");
CoordGR08SC   = np.load("$path""Coord_GR08_sc.npy");
CoordGR08Void = np.load("$path""Coord_GR08_void.npy");

In [6]:
Coord_obj = copy(CoordSZ);

Nsample = 10;

planck_map = copy(I_STOKES)*1e6;
i_pixel    = Array(Int64, 0)     # a list of pixel indices of a supercluster 
ids        = Array(Int64, 0)     # survived index of Coord_obj after sorting out bad samples
N_obj      = Array(Int64, 0)     # number of pixels in a region

println("---| Start clipping regions of superclusters: 30 deg x 30 deg (15 deg = $dtheta radian)")

i = 0; ntry = 1;

if Nsample > length(Coord_obj[:,1])
    Nsample = length(Coord_obj[:,1])
end
while (i < Nsample) & (ntry < length(Coord_obj))
    l, b = Coord_obj[ntry,:]
    θ = l * 180 / pi
    ϕ = b * 180 / pi
    #if (( θ > 15. ) & (θ < 75.)) | (( θ > 115. ) & (θ < 165.))
    N, ind = SpheCoord2Index(Coord_obj[ntry,1]-dtheta,Coord_obj[ntry,1]+dtheta,
    Coord_obj[ntry,2]-dtheta,Coord_obj[ntry,2]+dtheta;discrepancy=0.7)   
    if N > 0 
        i +=1        
        println("   |>> No. $i out of $ntry with angular position, (θ,ϕ) = (, )")            
        planck_map[ind] = hp.UNSEEN
        ids             = vcat(ids, i)
        N_obj           = vcat(N_obj, N)
        i_pixel         = vcat(i_pixel, ind)
        println("   |>> total N = $N")
    end
    #end
    ntry +=1
end


---| Start clipping regions of superclusters: 30 deg x 30 deg (15 deg = 0.2617993877991494 radian)
   |> dϕ = 0.0008260573356855261,  Nϕ = 633.8528247119501
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1350) array
   |>> No. 1 out of 1 with angular position, (θ,ϕ) = (57.097190518679, 286.98880321352937)
   |>> total N = 924750
   |> dϕ = 0.0007297101876213574,  Nϕ = 717.5434638031827
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1294) array
   |>> No. 2 out of 2 with angular position, (θ,ϕ) = (129.462116915104, 205.93719459223158)
   |>> total N = 883802
   |> dϕ = 0.000742244550913318,  Nϕ = 705.4262304169431
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(6271) and Nϕ... exit
   |> dϕ = 0.0006414030005430504,  Nϕ = 816.3335300193309
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1486) array
   |>> No. 3 out of 4 with angular position, (θ,ϕ) = (68.96845669141823, 180.25621906510185)
   |>> total N = 1017910
   |> dϕ = 6.281077421261747,  Nϕ = 0.083361299420684
   |> Poor resolution... exit
   |> dϕ = 0.0009611635480153424,  Nϕ = 544.7551321306875
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1248) array
   |>> No. 4 out of 6 with angular position, (θ,ϕ) = (37.54960983183388, 284.4102614165269)
   |>> total N = 852384
   |> dϕ = 0.0006489500982267415,  Nϕ = 806.8398125357154
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1250) array
   |>> No. 5 out of 7 with angular position, (θ,ϕ) = (41.20442857579598, 324.044849148257)
   |>> total N = 856250
   |> dϕ = 0.0008093038918453033,  Nϕ = 646.9742464779645
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1310) array
   |>> No. 6 out of 8 with angular position, (θ,ϕ) = (52.73022493975193, 186.37697014640372)
   |>> total N = 894730
   |> dϕ = 0.0011045396267803653,  Nϕ = 474.04254487866774
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(108) and Nϕ... exit
   |> dϕ = 0.0008244109974384628,  Nϕ = 635.1186207185237
   |> finding pixels in the region...
   |> Scheme No.2 & returning (429+1=430, 1260) array
   |>> No. 7 out of 10 with angular position, (θ,ϕ) = (135.34974888773323, 57.254166598421484)
   |>> total N = 541800
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0014571024303764446,  Nϕ = 359.3424626043803
   |> finding pixels in the region...
   |> Scheme No.3 & returning (430, 1248) array
   |>> No. 8 out of 11 with angular position, (θ,ϕ) = (14.794293373713483, 228.1607002269328)
   |>> total N = 536640
   |> dϕ = 0.00044326903914559956,  Nϕ = 1181.2211757616426
   |> finding pixels in the region...
   |> Scheme No.3 & returning (682, 1250) array
   |>> No. 9 out of 12 with angular position, (θ,ϕ) = (145.08411452923556, 56.93505177361814)
   |>> total N = 852500
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0009850212962875249,  Nϕ = 531.5608683504664
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(16) and Nϕ... exit
   |> dϕ = 0.0005760948405209021,  Nϕ = 908.876002300009
   |> finding pixels in the region...
   |> Scheme No.3 & returning (682, 1408) array
   |>> No. 10 out of 14 with angular position, (θ,ϕ) = (117.82534869028012, 73.97822266578889)
   |>> total N = 960256

Some of the clipped spuerclusters (SZ source) on the CMB map


In [7]:
hp.mollview(planck_map, xsize = 800, title = "Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)



In [8]:
Coord_obj = copy(CoordGR08SC);

Nsample = 20;

planck_map = copy(I_STOKES)*1e6;
i_pixel    = Array(Int64, 0)     # a list of pixel indices of a supercluster 
ids        = Array(Int64, 0)     # survived index of Coord_obj after sorting out bad samples
N_obj      = Array(Int64, 0)     # number of pixels in a region

println("---| Start clipping regions of superclusters: 30 deg x 30 deg (15 deg = $dtheta radian)")

i = 0; ntry = 1;

if Nsample > length(Coord_obj[:,1])
    Nsample = length(Coord_obj[:,1])
end
while (i < Nsample) & (ntry < length(Coord_obj))
    l, b = Coord_obj[ntry,:]
    θ = l * 180 / pi
    ϕ = b * 180 / pi
    #if (( θ > 15. ) & (θ < 75.)) | (( θ > 115. ) & (θ < 165.))
    N, ind = SpheCoord2Index(Coord_obj[ntry,1]-dtheta,Coord_obj[ntry,1]+dtheta,
    Coord_obj[ntry,2]-dtheta,Coord_obj[ntry,2]+dtheta;discrepancy=0.7)   
    if N > 0 
        i +=1        
        println("   |>> No. $i out of $ntry with angular position, (θ,ϕ) = (, )")            
        planck_map[ind] = hp.UNSEEN
        ids             = vcat(ids, i)
        N_obj           = vcat(N_obj, N)
        i_pixel         = vcat(i_pixel, ind)
        println("   |>> total N = $N")
    end
    #end
    ntry +=1
end


---| Start clipping regions of superclusters: 30 deg x 30 deg (15 deg = 0.2617993877991494 radian)
   |> dϕ = 0.0005161676571288076,  Nϕ = 1014.3967146466077
   |> finding pixels in the region...
   |> Scheme No.3 & returning (682, 1358) array
   |>> No. 1 out of 1 with angular position, (θ,ϕ) = (57.863911202212805, 181.53780858422533)
   |>> total N = 926156
   |> dϕ = 0.0005523651148240383,  Nϕ = 947.921513408929
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(5861) and Nϕ... exit
   |> dϕ = 0.0009522604409775148,  Nϕ = 549.8482905168404
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(4023) and Nϕ... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.002165895883733171,  Nϕ = 241.74697386460534
   |> finding pixels in the region...
   |> Scheme No.2 & returning (302+1=303, 858) array
   |>> No. 2 out of 4 with angular position, (θ,ϕ) = (5.700184797799451, 141.95137500511055)
   |>> total N = 259974
   |> dϕ = 0.0009216776998748344,  Nϕ = 568.0931367542081
   |> finding pixels in the region...
   |> Scheme No.3 & returning (529, 1286) array
   |>> No. 3 out of 5 with angular position, (θ,ϕ) = (21.879945085612086, 304.93773996188463)
   |>> total N = 680294
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0007798306053024007,  Nϕ = 671.4262969908182
   |> finding pixels in the region...
   |> Scheme No.3 & returning (419, 1216) array
   |>> No. 4 out of 6 with angular position, (θ,ϕ) = (14.040252066358658, 162.34403123923445)
   |>> total N = 509504
   |> dϕ = 0.0006469119607230844,  Nϕ = 809.3818129642367
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1348) array
   |>> No. 5 out of 7 with angular position, (θ,ϕ) = (56.70725304990242, 197.15287608118402)
   |>> total N = 923380
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0007306694638882227,  Nϕ = 716.6014203084295
   |> finding pixels in the region...
   |> Scheme No.3 & returning (368, 1062) array
   |>> No. 6 out of 8 with angular position, (θ,ϕ) = (10.450637003672483, 190.81786423028746)
   |>> total N = 390816
   |> dϕ = 0.000714562004877406,  Nϕ = 732.7548512576317
   |> finding pixels in the region...
   |> Scheme No.2 & returning (685+1=686, 1252) array
   |>> No. 7 out of 9 with angular position, (θ,ϕ) = (34.45373195050152, 67.57624611292012)
   |>> total N = 858872
   |> dϕ = 0.0008267337920726536,  Nϕ = 633.3341888513064
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1250) array
   |>> No. 8 out of 10 with angular position, (θ,ϕ) = (36.19193256947766, 81.7202097679334)
   |>> total N = 853750
   |> dϕ = 0.0007509114619669299,  Nϕ = 697.284303300937
   |> finding pixels in the region...
   |> Scheme No.1 & returning (32+638=670, 1260) array
   |>> No. 9 out of 11 with angular position, (θ,ϕ) = (32.16963120345096, 13.58926293795699)
   |>> total N = 844200
   |> dϕ = 6.281117950032207,  Nϕ = 0.08336076153379884
   |> Poor resolution... exit
   |> dϕ = 0.001131325034535502,  Nϕ = 462.8190481202226
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(6778) and Nϕ... exit
   |> dϕ = 0.0005577987118687844,  Nϕ = 938.6876743477845
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1248) array
   |>> No. 10 out of 14 with angular position, (θ,ϕ) = (38.37376524883129, 139.65554048799206)
   |>> total N = 854880
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0012782125242152276,  Nϕ = 409.63358258421687
   |> finding pixels in the region...
   |> Scheme No.3 & returning (357, 1030) array
   |>> No. 11 out of 15 with angular position, (θ,ϕ) = (9.68100064788687, 225.75232351853424)
   |>> total N = 367710
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0013159642950559824,  Nϕ = 397.88220513689873
   |> finding pixels in the region...
   |> Scheme No.3 & returning (407, 1180) array
   |>> No. 12 out of 16 with angular position, (θ,ϕ) = (13.204004469896812, 76.5817202761718)
   |>> total N = 480260
   |> dϕ = 0.000598288289990978,  Nϕ = 875.1613300106452
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1258) array
   |>> No. 13 out of 17 with angular position, (θ,ϕ) = (43.94750764908134, 36.68935341855142)
   |>> total N = 861730
   |> dϕ = 0.0006525053031585237,  Nϕ = 802.4437089840668
   |> finding pixels in the region...
   |> Scheme No.3 & returning (599, 1274) array
   |>> No. 14 out of 18 with angular position, (θ,ϕ) = (27.00545466706146, 111.22790897198799)
   |>> total N = 763126
   |> dϕ = 0.0006789902663393299,  Nϕ = 771.1432719370194
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8874) and Nϕ... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.001485476447847578,  Nϕ = 352.47867871414695
   |> finding pixels in the region...
   |> Scheme No.2 & returning (363+1=364, 1042) array
   |>> No. 15 out of 20 with angular position, (θ,ϕ) = (9.994354833005978, 49.822722570354735)
   |>> total N = 379288
   |> dϕ = 0.0013049557648672216,  Nϕ = 401.2387160507119
   |> finding pixels in the region...
   |> Scheme No.3 & returning (565, 1280) array
   |>> No. 16 out of 21 with angular position, (θ,ϕ) = (24.452356274689684, 55.49522563554731)
   |>> total N = 723200
   |> dϕ = 0.0008255062685607051,  Nϕ = 634.2759534839261
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1362) array
   |>> No. 17 out of 22 with angular position, (θ,ϕ) = (58.073907359447425, 174.07002951423067)
   |>> total N = 932970
   |> dϕ = 0.0008352875588423236,  Nϕ = 626.8485266606707
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8875) and Nϕ... exit
   |> dϕ = 0.0009369307617648204,  Nϕ = 558.8446841173602
   |> finding pixels in the region...
   |> Scheme No.3 & returning (470, 1296) array
   |>> No. 18 out of 24 with angular position, (θ,ϕ) = (17.6714081111627, 238.01151980606312)
   |>> total N = 609120
   |> dϕ = 0.0007830422706280871,  Nϕ = 668.6724270687388
   |> finding pixels in the region...
   |> Scheme No.2 & returning (508+1=509, 1290) array
   |>> No. 19 out of 25 with angular position, (θ,ϕ) = (20.22926387728769, 135.1626448641356)
   |>> total N = 656610
   |> dϕ = 0.0006474945938212961,  Nϕ = 808.6535093802006
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1248) array
   |>> No. 20 out of 26 with angular position, (θ,ϕ) = (39.314708969105325, 92.3432723862665)
   |>> total N = 852384

Some of the clipped spuerclusters (GR08) on the CMB map


In [9]:
hp.mollview(planck_map, xsize = 800, title = "Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)


Generating random sample (θ,ϕ) outside the foreground


In [13]:
Nrs = 50;
Ntry = 1; i = 0;
CoordRand  = Array(Float64, Nrs, 2)
N_rs       = Array(Int64, 0)
i_rs_pixel = Array(Int64, 0)
println("constructing random coordinates")
while i < Nrs
    θ = (rand() * 178 + 1.) * pi / 180.
    ϕ = rand() * 2pi
    #if (θ < 60.) | (θ > 120.)       # choose θ where  1 < θ < 75 or 105 < θ < 179 degree
    if planck_map_mask[pixelfunc.ang2pix(2048,θ,ϕ)] > hp.UNSEEN
        N, ind = SpheCoord2Index(θ-dtheta,θ+dtheta,ϕ-dtheta,ϕ+dtheta)   
        if N > 0
            i +=1        
            println("No. $i out of $Ntry tries with angular position, (θ,ϕ) = (", θ*180/pi, ", ", ϕ*180/pi,")")            
            N_rs            = vcat(N_rs, N)
            i_rs_pixel      = vcat(i_rs_pixel, ind)
            CoordRand[i,:]  = [θ, ϕ]
        end
    end
    Ntry += 1
end
np.save("$path""CoordRand""$Nrs",CoordRand)


constructing random coordinates
   |> dϕ = 0.000995593127252281,  Nϕ = 525.9164223475198
   |> finding pixels in the region...
   |> Scheme No.3 & returning (540, 1284) array
No. 1 out of 1 tries with angular position, (θ,ϕ) = (22.682542995226918, 53.69295671569621)
   |> dϕ = 0.000502148109150724,  Nϕ = 1042.717807867193
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(4596) and Nϕ... exit
   |> dϕ = 0.0009504560367346038,  Nϕ = 550.8921563559953
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1252) array
No. 2 out of 3 tries with angular position, (θ,ϕ) = (34.474515701004115, 123.79075772423235)
   |> dϕ = 6.281163893070641,  Nϕ = 0.08336015179860705
   |> Poor resolution... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0018200535021106745,  Nϕ = 287.6831779895991
   |> finding pixels in the region...
   |> Scheme No.2 & returning (401+1=402, 1156) array
No. 3 out of 6 tries with angular position, (θ,ϕ) = (12.636606102406455, 324.8748505023185)
   |> dϕ = 0.0009455438570326602,  Nϕ = 553.7540873476513
   |> finding pixels in the region...
   |> Scheme No.1 & returning (35+431=466, 1294) array
No. 4 out of 7 tries with angular position, (θ,ϕ) = (17.310564557947103, 12.784534005066861)
   |> dϕ = 0.000619356635257029,  Nϕ = 845.3914042286939
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8875) and Nϕ... exit
   |> dϕ = 0.0008845436553173158,  Nϕ = 591.9422658799876
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1268) array
No. 5 out of 9 tries with angular position, (θ,ϕ) = (133.92002221852172, 113.68711235050523)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0011633641688946206,  Nϕ = 450.07297766081285
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(5153) and Nϕ... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.001494589978593197,  Nϕ = 350.3293766837267
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(5580) and Nϕ... exit
   |> dϕ = 0.0008939831361596262,  Nϕ = 585.6920051619489
   |> finding pixels in the region...
   |> Scheme No.3 & returning (526, 1288) array
No. 6 out of 13 tries with angular position, (θ,ϕ) = (21.682097033855378, 151.01274307385768)
   |> dϕ = 0.000992523572525994,  Nϕ = 527.5429119186848
   |> finding pixels in the region...
   |> Scheme No.1 & returning (92+135=227, 1266) array
No. 7 out of 15 tries with angular position, (θ,ϕ) = (149.49822906602998, 2.9199367119383535)
   |> dϕ = 0.0004923418399038759,  Nϕ = 1063.4862470768792
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(251) and Nϕ... exit
   |> dϕ = 0.0006889866034485159,  Nϕ = 759.9549439387964
   |> finding pixels in the region...
   |> Scheme No.2 & returning (593+1=594, 1344) array
No. 8 out of 17 tries with angular position, (θ,ϕ) = (123.59377801024888, 57.77790678798135)
   |> dϕ = 0.0007691442734170106,  Nϕ = 680.7549554677847
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1280) array
No. 9 out of 19 tries with angular position, (θ,ϕ) = (131.49942797063954, 41.60143909179656)
   |> dϕ = 0.0007990449255390608,  Nϕ = 655.280771910369
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1252) array
No. 10 out of 20 tries with angular position, (θ,ϕ) = (34.82461773046559, 148.89220637937524)
   |> dϕ = 0.0008439082055979319,  Nϕ = 620.4451765311546
   |> finding pixels in the region...
   |> Scheme No.1 & returning (137+141=278, 1254) array
No. 11 out of 21 tries with angular position, (θ,ϕ) = (145.95373368137643, 0.22264371527278118)
   |> dϕ = 0.0007322471946915599,  Nϕ = 715.0574005528975
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1502) array
No. 12 out of 22 tries with angular position, (θ,ϕ) = (109.38520843790702, 245.26810391993388)
   |> dϕ = 0.0010669989297271698,  Nϕ = 490.72099419273246
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8300) and Nϕ... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.001360057997406905,  Nϕ = 384.98268205958493
   |> finding pixels in the region...
   |> Scheme No.3 & returning (396, 1146) array
No. 13 out of 26 tries with angular position, (θ,ϕ) = (12.416629548529142, 324.3711913218178)
   |> dϕ = 6.282077334614434,  Nϕ = 0.08334803086763248
   |> Poor resolution... exit
   |> dϕ = 0.0006837445055887237,  Nϕ = 765.7813281402025
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8874) and Nϕ... exit
   |> dϕ = 0.0007897352463961393,  Nϕ = 663.0054540273819
   |> finding pixels in the region...
   |> Scheme No.2 & returning (324+1=325, 1286) array
No. 14 out of 30 tries with angular position, (θ,ϕ) = (21.684474930593947, 86.61824960230808)
   |> dϕ = 0.0006612153954401734,  Nϕ = 791.8732370859827
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8875) and Nϕ... exit
   |> dϕ = 0.001593059422304588,  Nϕ = 328.67498115094713
   |> finding pixels in the region...
   |> Scheme No.3 & returning (446, 1298) array
No. 15 out of 33 tries with angular position, (θ,ϕ) = (164.11079959838412, 136.04270645451652)
   |> dϕ = 0.0007348194872109914,  Nϕ = 712.5542867481894
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1402) array
No. 16 out of 34 tries with angular position, (θ,ϕ) = (118.22322563135796, 324.82988589648613)
   |> dϕ = 0.0006484425521096071,  Nϕ = 807.4713386634652
   |> finding pixels in the region...
   |> Scheme No.3 & returning (621, 1270) array
No. 17 out of 35 tries with angular position, (θ,ϕ) = (28.648338486478977, 322.788584243923)
   |> dϕ = 0.0007578462571977695,  Nϕ = 690.9036900629028
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1532) array
No. 18 out of 38 tries with angular position, (θ,ϕ) = (74.39856269721994, 236.3237661079428)
   |> dϕ = 0.0008116037417487121,  Nϕ = 645.1409088752259
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1254) array
No. 19 out of 39 tries with angular position, (θ,ϕ) = (34.261172768626594, 325.33191649971076)
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 6.253831982749871,  Nϕ = 0.0837244711790397
   |> Poor resolution... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0017277723862478833,  Nϕ = 303.04846851695083
   |> finding pixels in the region...
   |> Scheme No.2 & returning (344+1=345, 984) array
No. 20 out of 42 tries with angular position, (θ,ϕ) = (8.636273761075437, 58.031483052127655)
   |> dϕ = 0.0008147574722707773,  Nϕ = 642.6437233389188
   |> finding pixels in the region...
   |> Scheme No.3 & returning (539, 1286) array
No. 21 out of 43 tries with angular position, (θ,ϕ) = (22.591024505228262, 333.4041527149185)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0019493595450403856,  Nϕ = 268.60041131481023
   |> finding pixels in the region...
   |> Scheme No.3 & returning (265, 752) array
No. 22 out of 45 tries with angular position, (θ,ϕ) = (3.223965742913924, 53.20906464229678)
   |> dϕ = 0.0007188036203280568,  Nϕ = 728.4309104610968
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8037) and Nϕ... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0018179026369562479,  Nϕ = 288.0235525016736
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(7) and Nϕ... exit
   |> dϕ = 0.0007609835588178182,  Nϕ = 688.0553062298812
   |> finding pixels in the region...
   |> Scheme No.3 & returning (474, 1294) array
No. 23 out of 50 tries with angular position, (θ,ϕ) = (17.968674207996813, 77.77087531198784)
   |> dϕ = 0.0007465040742190565,  Nϕ = 701.401095695363
   |> finding pixels in the region...
   |> Scheme No.1 & returning (165+462=627, 1370) array
No. 24 out of 51 tries with angular position, (θ,ϕ) = (121.07945524819193, 7.1276386234079245)
   |> dϕ = 0.0009179604926212726,  Nϕ = 570.3935842632417
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1324) array
No. 25 out of 57 tries with angular position, (θ,ϕ) = (54.23287584763094, 77.27222659074464)
   |> dϕ = 0.0010705042610332782,  Nϕ = 489.11414429393045
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(7467) and Nϕ... exit
   |> dϕ = 0.0007569438627417213,  Nϕ = 691.727354392933
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1418) array
No. 26 out of 61 tries with angular position, (θ,ϕ) = (117.05697007045174, 253.21227309838272)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.002421153128979503,  Nϕ = 216.2600825743688
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(3312) and Nϕ... exit
   |> dϕ = 0.0005040228206310005,  Nϕ = 1038.839421879332
   |> finding pixels in the region...
   |> Scheme No.2 & returning (618+1=619, 1362) array
No. 27 out of 63 tries with angular position, (θ,ϕ) = (121.70482230828429, 74.89818807016682)
   |> dϕ = 0.0004657619959802517,  Nϕ = 1124.1766827633116
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(6254) and Nϕ... exit
   |> dϕ = 0.0010821053280234416,  Nϕ = 483.87043482605975
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(2632) and Nϕ... exit
   |> dϕ = 0.0010019028620167347,  Nϕ = 522.6043316657904
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(4055) and Nϕ... exit
   |> dϕ = 0.0006579047712773622,  Nϕ = 795.8580002113379
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1388) array
No. 28 out of 67 tries with angular position, (θ,ϕ) = (60.61084083521723, 153.16298842703424)
   |> dϕ = 0.0008684271015246825,  Nϕ = 602.9277237882435
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1250) array
No. 29 out of 70 tries with angular position, (θ,ϕ) = (40.43003258246848, 70.81938341726786)
   |> dϕ = 0.0013897467081407378,  Nϕ = 376.7584211793467
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(63) and Nϕ... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.002630234696163747,  Nϕ = 199.069222363304
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(17) and Nϕ... exit
   |> dϕ = 0.0005226864938130404,  Nϕ = 1001.7453708792111
   |> finding pixels in the region...
   |> Scheme No.2 & returning (654+1=655, 1392) array
No. 30 out of 74 tries with angular position, (θ,ϕ) = (119.08340411051667, 65.33540740530738)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.001720399591909172,  Nϕ = 304.3471865842793
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(4538) and Nϕ... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0015975249381758871,  Nϕ = 327.75624535549514
   |> finding pixels in the region...
   |> Scheme No.3 & returning (240, 678) array
No. 31 out of 76 tries with angular position, (θ,ϕ) = (178.47092325695647, 266.454931808868)
   |> dϕ = 0.000619331563300296,  Nϕ = 845.4256276042902
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8875) and Nϕ... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 6.23336924019479,  Nϕ = 0.08399931969727756
   |> Poor resolution... exit
   |> dϕ = 0.0006962848061577986,  Nϕ = 751.9893741292343
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1342) array
No. 32 out of 79 tries with angular position, (θ,ϕ) = (56.34923289379386, 308.3097151942681)
   |> dϕ = 0.0013563367396830506,  Nϕ = 386.03892402166554
   |> finding pixels in the region...
   |> Scheme No.3 & returning (441, 1298) array
No. 33 out of 81 tries with angular position, (θ,ϕ) = (15.563348959227687, 32.543316373544414)
   |> dϕ = 0.0005623516335386824,  Nϕ = 931.0878538815206
   |> finding pixels in the region...
   |> Scheme No.3 & returning (633, 1268) array
No. 34 out of 83 tries with angular position, (θ,ϕ) = (150.45958337739768, 158.4107044012294)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0013678035187210114,  Nϕ = 382.802623645755
   |> finding pixels in the region...
   |> Scheme No.2 & returning (307+1=308, 874) array
No. 35 out of 84 tries with angular position, (θ,ϕ) = (6.0269277007869695, 64.8506699324842)
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0013253369263499515,  Nϕ = 395.0684276490493
   |> finding pixels in the region...
   |> Scheme No.3 & returning (403, 1166) array
No. 36 out of 86 tries with angular position, (θ,ϕ) = (167.1200430758456, 204.6715803439787)
   |> dϕ = 0.0007601484957658888,  Nϕ = 688.8111711261704
   |> finding pixels in the region...
   |> Scheme No.2 & returning (390+1=391, 1252) array
No. 37 out of 87 tries with angular position, (θ,ϕ) = (138.15010125922808, 38.0204115431394)
   |> dϕ = 0.0006996058307706665,  Nϕ = 748.4196851554492
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1458) array
No. 38 out of 88 tries with angular position, (θ,ϕ) = (113.56859468587265, 72.0595249135741)
   |> dϕ = 6.2823844470422,  Nϕ = 0.08334395642482736
   |> Poor resolution... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0031275393116918515,  Nϕ = 167.41556969113088
   |> finding pixels in the region...
   |> Scheme No.3 & returning (247, 698) array
No. 39 out of 90 tries with angular position, (θ,ϕ) = (178.03116335293146, 71.59783222420585)
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0015915904639646206,  Nϕ = 328.978331708538
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(16) and Nϕ... exit
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0016174292379727007,  Nϕ = 323.72283331206637
   |> finding pixels in the region...
   |> Scheme No.3 & returning (400, 1154) array
No. 40 out of 94 tries with angular position, (θ,ϕ) = (167.38450238406492, 192.1402162779146)
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0014295513547107896,  Nϕ = 366.2679020749326
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(18) and Nϕ... exit
   |> dϕ = 0.0008043161770112661,  Nϕ = 650.986254614353
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8874) and Nϕ... exit
   |> dϕ = 0.0006020126315311458,  Nϕ = 869.7471584052804
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1374) array
No. 41 out of 98 tries with angular position, (θ,ϕ) = (59.34562292054612, 141.6453804341154)
   |> dϕ = 0.000747211400488279,  Nϕ = 700.7371344389869
   |> finding pixels in the region...
   |> Scheme No.2 & returning (656+1=657, 1396) array
No. 42 out of 100 tries with angular position, (θ,ϕ) = (118.85962291122291, 107.47671919034794)
   |> dϕ = 0.0007287782023555067,  Nϕ = 718.4610817200053
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1284) array
No. 43 out of 101 tries with angular position, (θ,ϕ) = (49.209070946567, 245.6418378348039)
   |> dϕ = 0.0010256597212929819,  Nϕ = 510.49950069037766
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1274) array
No. 44 out of 102 tries with angular position, (θ,ϕ) = (47.387847396718456, 183.2884019955033)
   |> dϕ = 0.0007823406198763649,  Nϕ = 669.2721332570513
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8875) and Nϕ... exit
   |> dϕ = 0.00048603381351064456,  Nϕ = 1077.2887832974423
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1472) array
No. 45 out of 105 tries with angular position, (θ,ϕ) = (67.68798247841052, 272.5722499700352)
   |> dϕ = 0.0008091674861843146,  Nϕ = 647.0833103630561
   |> finding pixels in the region...
   |> Found a huge discrepancy btwn Nϕpix(8874) and Nϕ... exit
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 6.2598499968570085,  Nϕ = 0.08364398122338244
   |> Poor resolution... exit
   |> dϕ = 0.0006163477586591526,  Nϕ = 849.5184224201183
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1414) array
No. 46 out of 108 tries with angular position, (θ,ϕ) = (62.67427907073874, 164.67622433625496)
   |> dϕ = 0.00046637287869355504,  Nϕ = 1122.704169815898
   |> finding pixels in the region...
   |> Scheme No.3 & returning (682, 1418) array
No. 47 out of 109 tries with angular position, (θ,ϕ) = (116.98508775306985, 331.54603725411084)
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0013018729858389477,  Nϕ = 402.18883200874143
   |> finding pixels in the region...
   |> Scheme No.3 & returning (321, 920) array
No. 48 out of 110 tries with angular position, (θ,ϕ) = (172.85633583604175, 216.28054835936524)
   |> dϕ = 0.000691671660939086,  Nϕ = 757.004811918137
   |> finding pixels in the region...
   |> Scheme No.2 & returning (474+1=475, 1276) array
No. 49 out of 112 tries with angular position, (θ,ϕ) = (132.18130989935992, 247.13810450801938)
   |> θmin is smaller than 1° ... set θmin = 1°
   |> dϕ = 0.0025287105647320285,  Nϕ = 207.06156841393405
   |> finding pixels in the region...
   |> Scheme No.3 & returning (281, 800) array
No. 50 out of 113 tries with angular position, (θ,ϕ) = (4.339089644687288, 55.56176638838463)

In [11]:
CoordRand = np.load("$path""CoordRand10.npy");
planck_map = copy(I_STOKES)*1e6
for i = 1:length(CoordRand[:,1])
    l, b = CoordRand[i,:]
    N, ind = SpheCoord2Index(CoordRand[i,1]-dtheta,CoordRand[i,1]+dtheta,
    CoordRand[i,2]-dtheta,CoordRand[i,2]+dtheta) 
    planck_map[ind] = hp.UNSEEN
end


   |> dϕ = 0.0007486150668025715,  Nϕ = 699.4232400833912
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1248) array
   |> dϕ = 0.00087044231136435,  Nϕ = 601.5318519817796
   |> finding pixels in the region...
   |> Scheme No.2 & returning (394+2=396, 1362) array
   |> dϕ = 0.0006420673031186652,  Nϕ = 815.4889262466133
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1256) array
   |> dϕ = 0.0007804321346993603,  Nϕ = 670.9087854256541
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1448) array
   |> θmax is greater than 179° ... set θmax = 179°
   |> dϕ = 0.0017450046706217748,  Nϕ = 300.05580180580927
   |> finding pixels in the region...
   |> Scheme No.3 & returning (240, 678) array
   |> dϕ = 0.0009427759429527782,  Nϕ = 555.3798646562677
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1248) array
   |> dϕ = 0.0011964882764639029,  Nϕ = 437.6129594397206
   |> finding pixels in the region...
   |> Scheme No.3 & returning (546, 1284) array
   |> dϕ = 0.0007491185122392441,  Nϕ = 698.9531923769604
   |> finding pixels in the region...
   |> Scheme No.2 & returning (684+1=685, 1330) array
   |> dϕ = 0.0014973834741374148,  Nϕ = 349.6758075949278
   |> finding pixels in the region...
   |> Scheme No.3 & returning (468, 1296) array
   |> dϕ = 0.0009491744641154654,  Nϕ = 551.6359693538953
   |> finding pixels in the region...
   |> Scheme No.3 & returning (683, 1254) array

In [14]:
hp.mollview(planck_map, xsize = 800, title = "Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)



In [16]:
function GKernel(x::Float64,y::Float64,x₀::Float64,y₀::Float64)
    r2 = (x-x₀)^2. + (y-y₀)^2.
    if r2 < σlim2
        return exp( -r2 / σnorm2 )
    else
        return 0.
    end
end


Out[16]:
GKernel (generic function with 1 method)

In [29]:
x1d      = linspace(-XYsize*0.5,XYsize*0.5,Nsize)
y1d      = linspace(XYsize*0.5,-XYsize*0.5,Nsize)
Tmap     = Float64[ GKernel(xi,yi,0.,0.) for xi in x1d, yi in y1d];
Umap     = Float64[ GKernel(xi,yi,0.,0.)>0.? 1.:0. for xi in x1d, yi in y1d];
TmapNorm =  sum(Tmap);
Tmap    /= TmapNorm;

Gaussian Kernel (2-dim) with FHWM of 30 arcmin at 100 GHz


In [326]:
PyPlot.figure(figsize=(5,5))
PyPlot.imshow(Tmap, origin='l', extent= [-dtheta_deg,dtheta_deg,-dtheta_deg,dtheta_deg]);
PyPlot.title("A Gaussian kernel with FWHM = 30'",fontsize=10)
PyPlot.xlabel("degree (\$\\degree\$\)")
PyPlot.ylabel("degree (\$\\degree\$\)")
PyPlot.colorbar(label= " \$\\mu\$\K\$\_{CMB}\$\ ");


Testing if superposition of unit kernel works well.


In [346]:
#x   = rand(30) * XYsize - 0.5XYsize
#y   = rand(30) * XYsize - 0.5XYsize
x   = [linspace(-XYsize/2,XYsize/2, 10); linspace(-XYsize/2,XYsize/2, 10);zeros(2)]
y   = [linspace(-XYsize/2,XYsize/2, 10); zeros(10);zeros(2)]
θc, ϕc = 0., 0.;
TestMap = zeros(Nsize,Nsize)
for i =1:length(x)
    θ, ϕ = x[i], y[i]
    row_shift = Int64(round( (θ - θc) /res )) 
    col_shift = Int64(round( (ϕ - ϕc) /res ))
    TestMap += ShiftArray(Tmap, row_shift, col_shift)
end
PyPlot.figure(figsize=(5,5))
PyPlot.imshow(TestMap, origin='l', extent= [-dtheta_deg,dtheta_deg,-dtheta_deg,dtheta_deg])
PyPlot.title("Testing superposition of kernels",fontsize=12)
PyPlot.xlabel("degree (\$\\degree\$\)")
PyPlot.ylabel("degree (\$\\degree\$\)")
PyPlot.colorbar(label= " \$\\mu\$\K\$\_{CMB}\$\ ");


Masking Point Sources only

(Since we chose objects outside the foreground)


In [17]:
planck_map = copy(I_STOKES) * 1e6 # Converting it to mu K scale;
Tmin = -593.5015506111085 # mu K
Tmax = 137299.59726333618 # mu K

for i = 1:length(PtMap)
    if PtMap[i] == 0.
        planck_map[i] = hp.UNSEEN
    end
end

Generating images of supercluster / random position

: I have run "makeonerandimg.jl" and "makeonetargetimg.jl" to construct them.

Stacked (averaged) SZ sources (μK)


In [32]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 200;
for i = Nmin:Nmax
    if cnt == 0
        try
            img = np.load("$path""img/targetimg_highres_Coord_SZ_$i""_HFI.npy");
            cnt += 1
            Nsize = size(img)[1]
        end
    else
        try
            img += np.rot90(np.load("$path""img/targetimg_highres_Coord_SZ_$i""_HFI.npy"),Int(floor(rand()*4.)))
            cnt += 1
        catch
        end 
    end
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -30.; vmax = 100.
#vmax = 0.5*(abs(vmin)+abs(vmax))
#vmin = -vmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked SZ sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=0.,vmax=60.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 60 images: mean = 53.669014638894986 , std = 21.584707491182627

In [33]:
imgrand = zeros(Nsize,Nsize)
Nmin = 1; Nmax = 100; cnt =0;
ind_use = Array(Int64, 0)
add = 0
for i = 1:Nmax
    try
        np.load("$path""img/randimg_highres_CoordRand100_$i""_HFI.npy");
        ind_use = vcat(ind_use, i)        
    catch
    end
end
#ind_use = pick_random_ind(ind_use, Ntot)
for i = 1:Nmax
    n = ind_use[i]
    imgrand += np.rot90(np.load("$path""img/randimg_highres_CoordRand100_$n""_HFI.npy"),Int(floor(rand()*4.)))
    #imgrand += np.load("$path""img/randimg_highres_CoordRand100_$n""_HFI.npy");
end
imgrand /= Nmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked random positions",fontsize=15)

μ = mean(imgrand); noise = std(imgrand)
println("Stacked $Nmax images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,imgrand;vmin=-60,vmax=60)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 100 images: mean = 42.20560740442243 , std = 14.013855332868198

In [35]:
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
vmin = -50.; vmax = 50.;
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)
μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img-imgrand;vmin=-30.,vmax=30.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = 11.463407234472553 , std = 25.791291941903115

Stacked (averaged) cluster sources from GR08 paper (μK)


In [36]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 100;
for i = Nmin:Nmax
    try
        img += np.rot90(np.load("$path""img/targetimg_highres_Coord_GR08_sc_$i""_HFI.npy"),Int(floor(rand()*4.)))
        cnt += 1
    catch
    end    
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -30.; vmax = 100.;
#vmax = 0.5*(abs(vmin)+abs(vmax))
#vmin = -vmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked GR08 sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=-20.,vmax=80)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 50 images: mean = 34.88323662365665 , std = 20.28674564959814

In [38]:
Nmin = 1; Nmax = 100; cnt =0;
ind_use = Array(Int64, 0)
add = 0
for i = 1:Nmax
    try
        np.load("$path""img/randimg_highres_CoordRand100_$i""_HFI.npy");
        ind_use = vcat(ind_use, i)        
    catch
    end
end
#imgrand = zeros(Nsize,Nsize)
#ind_use = pick_random_ind(ind_use, Ntot)
#for i = 1:Nmax
#    n = ind_use[i]
#    #imgrand += np.load("$path""img/randimg_highres_CoordRand100_$n""_HFI.npy");
#    imgrand += np.rot90(np.load("$path""img/randimg_highres_CoordRand100_$n""_HFI.npy"),Int(floor(rand()*4.)))
#end
#imgrand /= Nmax

PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
vmin = -50.; vmax = 50.;
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)

μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img - imgrand;vmin=-30.,vmax=30.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = -7.322370780765775 , std = 25.431481710091173

Stacked (averaged) VOID sources from GR08 paper (μK)


In [43]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 50;
for i = Nmin:Nmax
    try
        img += np.rot90(np.load("$path""img/targetimg_highres_Coord_GR08_void_$i""_HFI.npy"),Int(floor(rand()*4.)))
        cnt += 1
    catch
    end    
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -30.; vmax = 100.;
#vmax = 0.5*(abs(vmin)+abs(vmax))
#vmin = -vmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked GR08 VOID sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=-20.,vmax=50.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 50 images: mean = 32.44422852938567 , std = 19.08038880153817

In [44]:
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
vmin = -50.; vmax = 50.;
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)

μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img - imgrand;vmin=-50.,vmax=30.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = -9.761378875036758 , std = 24.735007838802247

In [48]:
SMICA="COM_CMB_IQU-smica-field-Int_2048_R2.01_full.fits"
I_SMICA = hp.read_map("$path$SMICA", field = 0, memmap = true);


NSIDE = 2048
ORDERING = NESTED in fits file
INDXSCHM = IMPLICIT
Ordering converted to RING

In [298]:
hp.mollview(I_SMICA*1e6, xsize = 800, title = "(SMICA) Intensity Map (\$\\mu\$\K\$\_{CMB}\$\)", min = -300, max = 300)


Stacked (averaged) SZ sources (μK)


In [48]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 200;
for i = Nmin:Nmax
    try
        img += np.rot90(np.load("$path""img/targetimg_highres_Coord_SZ_$i""_SMICA.npy"),Int(floor(rand()*4.)));
        cnt += 1
    catch
    end    
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -80.; vmax = 100.
#vmax = 0.5*(abs(vmin)+abs(vmax))
#vmin = -vmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked SZ sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=-20.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 49 images: mean = 5.788748304929379 , std = 22.55388829775374

In [53]:
imgrand = zeros(Nsize,Nsize)
Nmin = 1; Nmax = 100; cnt =0;
ind_use = Array(Int64, 0)
add = 0
for i = 1:Nmax
    try
        np.load("$path""img/randimg_highres_CoordRand100_$i""_SMICA.npy");
        ind_use = vcat(ind_use, i)        
    catch
    end
end
#ind_use = pick_random_ind(ind_use, Ntot)
for i = 1:length(ind_use)
    n = ind_use[i]
    imgrand += np.rot90(np.load("$path""img/randimg_highres_CoordRand100_$n""_SMICA.npy"),Int(floor(rand()*4.)))
end
imgrand /= length(ind_use)
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked random positions",fontsize=15)
cnt = length(ind_use)
μ = mean(imgrand); noise = std(imgrand)
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,imgrand;vmin=-20.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 100 images: mean = 6.045797326435919 , std = 14.023158757650487

In [51]:
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)
μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img-imgrand;vmin=-30.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = -0.2570490215065399 , std = 26.62291034842293

Stacked (averaged) cluster sources from GR08 paper (μK)


In [13]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 100;
for i = Nmin:Nmax
    try
        img += np.rot90(np.load("$path""img/targetimg_highres_Coord_GR08_sc_$i""_SMICA.npy"),Int(floor(rand()*4.)))
        cnt += 1
    catch
    end    
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -50.; vmax = 50.
#vmin = max(abs(vmin),abs(vmax))
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked GR08 sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=-20.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 50 images: mean = -1.5366761567644955 , std = 21.33150138041286

In [14]:
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)

μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img-imgrand;vmin=-20.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = -7.582473483200414 , std = 25.87108618164883

Stacked (averaged) VOID sources from GR08 paper (μK)


In [28]:
img = zeros(Nsize,Nsize)
cnt = 0
Nmin = 1; Nmax = 50;
for i = Nmin:Nmax
    try
        img += np.rot90(np.load("$path""img/targetimg_highres_Coord_GR08_void_$i""_SMICA.npy"),Int(floor(rand()*4.)))
        cnt += 1
    catch
    end    
end
img /= cnt
vmin = np.min(img); vmax = np.max(img)
vmin = -50.; vmax = 50.;
#vmax = 0.5*(abs(vmin)+abs(vmax))
#vmin = -vmax
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img,vmin,vmax,dtheta_deg)
PyPlot.title("Stacked GR08 VOID sources",fontsize=15)

μ = mean(img); noise = std(img)
Ntot = copy(cnt);
println("Stacked $cnt images: mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img;vmin=-50.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


Stacked 50 images: mean = -0.24345660854895138 , std = 18.966566800139663

In [24]:
PyPlot.figure(figsize=(12,4))
PyPlot.subplot(1, 2, 1)
PlotTmap(img-imgrand,vmin,vmax,dtheta_deg)
PyPlot.title("Residual image",fontsize=15)

μ = mean(img - imgrand); noise = std(img - imgrand)
println("mean =  , std = $noise")
PyPlot.subplot(1, 2, 2)
PlotTempProfile(15.,0.2,img-imgrand;vmin=-50.,vmax=20.)
PyPlot.tight_layout(pad=0.4, w_pad=0.5, h_pad=1.0)


mean = -6.28925393498487 , std = 23.995510107110654

Discussion

(in progress ... )

To check ISW effect on the CMB, I have used two different CMB maps: HFI map at 100 GHz and SMICA image which went through SMICA pipline. I stopped my analysis at this step because I could not see a clear difference between stacked images of superclusters/voids and random positions. The amount of excess or deficit in temperature is much smaller than GR08 paper or Planck results by two orders of magnitude. Possible reasons for this would be from:

1. coordinate transformation
2. resolution of stacked image

  1. coordinate transformation : the coordinates of superclusters are given by Galactic coordinate system,(l, b) while Healpix uses spherical coordinates (θ, ϕ). I changed galactic coordinates to spherical ones by: ϕ [rad] = pi / 180 b [deg] θ [rad] = pi / 2 - pi / 180 l [deg] If the transformation is wrong, I stack wrong positions

  2. resolution : Since the resolution of the stacked image is smaller than the Planck CMB map, I have taken the average of temperatures in the same pixel position. I think this would lead to small fluctuations of temperature as seen above. I want to see any changes if I raise the resolution as the same as the Planck CMB map (even after this quarter)

Although I upload my current progress to Github, I will check and fix the issues mentioned above.